LanguageExt.Core

LanguageExt.Core Monads Alternative Value Monads

Alternative Value Monads are monadic types that can have an alternative value! What does this mean?

If first we think about a tuple:

(int, string)

This type can represent an int AND a string. Now consider the Either<L, R> monad, this means the value can either be Left or Right (L or R). So this:

Either<int, string>

Means either int OR string. It is the natural dual to a tuple.

In the case of Either the Right value is considered the bound value of the monad, and the Left value is considered the alternative value. All of the other alternative value monads can be seen as derivatives or specialisations of Either.

Type Bound Value Type Alternative Value Type
Option<A> A None
Fin<A> A Error
Try<A> A Exception
Validation<F, S> S Seq<F>
Nullable<A> A null

The alternative value is usually used to carry errors, but that doesn't have to be the case

Contents

Sub modules

Either
Fin
Nullable
Option
Some
Try
Validation